package com.campuscarbooking.api.dto.response;

import com.campuscarbooking.api.model.User;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class LoginResponse {
    private String token;
    private UserDto user;

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class UserDto {
        private Long id;
        private String nickname;
        private String avatarUrl;
        private String phone;
        private User.UserType userType;

        public static UserDto fromUser(User user) {
            return UserDto.builder()
                    .id(user.getId())
                    .nickname(user.getNickname())
                    .avatarUrl(user.getAvatarUrl())
                    .phone(user.getPhone())
                    .userType(user.getUserType())
                    .build();
        }
    }
} 